// pages/productDetails/comment.js
const app = getApp()
var http = require('../../utils/server.js')
var util = require('../../utils/util.js')

Page({
  data: {

  },
  onLoad: function (options) {
    var id = options.id;
    console.info(id);
    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2]; //上一个页面（父页面）
    this.setData({ id: id, data:prevPage.data.data});
    this.loadData(-1);
  },
  loadData:function(tags){
    //tags - 1全部 0带图 1好评 2差评
    var that = this;
    var id = that.data.id;

    http.post({
      url: "Product/getEvaluateList",
      tags:tags,
      product_id:id,
      type: ''
    }, function (data) {
      that.setData({comments: data.data });
    })
  },

})